public class SimpleDateFormat3 {
    public static void main(String[] args) {
        try {
            long timeStamp = System.currentTimeMillis();//获取当前时间戳
            java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String sd = sdf.format(new java.util.Date(Long.parseLong(String.valueOf(timeStamp))));      // 时间戳转换成时间
            System.out.println("格式化结果：" + sd);
        } catch (NumberFormatException e) {
            throw new RuntimeException(e);
        }
    }
}
